package com.amap.api.col.s;

import android.content.Context;
import com.amap.api.services.auto.AutoTChargeStationResult;
import com.amap.api.services.auto.AutoTSearch;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.core.LatLonPoint;
import java.util.HashMap;
import org.json.JSONObject;

/* compiled from: AutoTPoiSearchHandler.java */
/* loaded from: classes.dex */
public final class b extends f<AutoTSearch.Query, AutoTChargeStationResult> {
    private a g;

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.amap.api.col.s.f, com.amap.api.col.s.e
    public final /* synthetic */ Object a(String str) throws AMapException {
        return c(str);
    }

    public b(Context context, AutoTSearch.Query query) {
        super(context, query);
        this.g = null;
        this.g = new a(context);
    }

    @Override // com.amap.api.col.s.f, com.amap.api.col.s.e
    protected final String a_() {
        StringBuilder sb = new StringBuilder(this.g.a());
        sb.append("&adcode=");
        sb.append(((AutoTSearch.Query) this.b).getAdCode());
        sb.append("&city=");
        sb.append(((AutoTSearch.Query) this.b).getCity());
        sb.append("&data_type=");
        sb.append(((AutoTSearch.Query) this.b).getDataType());
        sb.append("&geoobj=");
        sb.append(((AutoTSearch.Query) this.b).getGeoObj());
        sb.append("&keywords=");
        sb.append(((AutoTSearch.Query) this.b).getKeywords());
        sb.append("&pagenum=");
        sb.append(((AutoTSearch.Query) this.b).getPageNum());
        sb.append("&pagesize=");
        sb.append(((AutoTSearch.Query) this.b).getPageSize());
        sb.append("&qii=");
        sb.append(((AutoTSearch.Query) this.b).isQii());
        sb.append("&query_type=");
        sb.append(((AutoTSearch.Query) this.b).getQueryType());
        sb.append("&range=");
        sb.append(((AutoTSearch.Query) this.b).getRange());
        LatLonPoint latLonPoint = ((AutoTSearch.Query) this.b).getLatLonPoint();
        if (latLonPoint != null) {
            sb.append("&longitude=");
            sb.append(latLonPoint.getLongitude());
            sb.append("&latitude=");
            sb.append(latLonPoint.getLatitude());
        }
        sb.append("&user_loc=");
        sb.append(((AutoTSearch.Query) this.b).getUserLoc());
        sb.append("&user_city=");
        sb.append(((AutoTSearch.Query) this.b).getUserCity());
        AutoTSearch.FilterBox filterBox = ((AutoTSearch.Query) this.b).getFilterBox();
        if (filterBox != null) {
            sb.append("&retain_state=");
            sb.append(filterBox.getRetainState());
            sb.append("&checked_level=");
            sb.append(filterBox.getCheckedLevel());
            sb.append("&classify_v2_data=");
            sb.append(filterBox.getClassifyV2Data());
            sb.append("&classify_v2_level2_data=");
            sb.append(filterBox.getClassifyV2Level2Data());
            sb.append("&classify_v2_level3_data=");
            sb.append(filterBox.getClassifyV2Level3Data());
        }
        return sb.toString();
    }

    private static AutoTChargeStationResult c(String str) throws AMapException {
        try {
            return c.a(new JSONObject(str));
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override // com.amap.api.col.s.dz
    public final String b() {
        try {
            String a = d.a(new HashMap(), ((AutoTSearch.Query) this.b).getAccessKey());
            String a2 = d.a("POST", a, ((AutoTSearch.Query) this.b).getSecretKey());
            return m.f() + "/ws/mapapi/poi/infolite/auto?" + a + "&Signature=" + a2;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
